This invention relates to the generation and attenuation of digital signals for input to a digital to analog converter to produce an audible tone. More specifically, it relates to use of a digital signal processor (DSP) to generate pulse coded modulation (PCM) values representing a set of predefined tones in a memory space and processing cycles efficient manner.
A tone is a pure sine wave. Pulse coded modulation (PCM) data is a digital representation of an analog signal, such as a sine wave, at fixed time intervals.
Digital signal processors (DSPs) may be used to generate tones. This they do by generating electrical signals which are input to a digital to analog converter (DAC) to produce an analog electrical signal that will cause one of a set of tones to be produced with an appropriate audio amplifier and speaker. These processors usually have limited function, providing only fixed point operations and multiply, but not divide.
If a tone stops at a non-zero value, or the tone goes to zero at a high rate, or the sine is distorted by being attenuated at an increasing rate, the resulting sound will contain xe2x80x9cclicksxe2x80x9d, xe2x80x9cpopsxe2x80x9d, or xe2x80x9cthudsxe2x80x9d. Since tone duration may be short (say, 0.1 seconds) and there may only be between 16,000 and 48,000 samples per second, the whole tone may contain only 1600 samples. Attenuation should be complete in about ten percent of these samples, and the solution should use little code and little memory.
For short tones the attenuation duration must also be short. As the duration of a sine or of a few sine oscillations approach the period of the attenuation duration, noiseless attenuation becomes difficult. Some distortion must be expected. For instance, a sine wave cannot be changed during a half wave and still be a pure sine wave.
Synchronization of digital video and digital audio data streams is a requirement of the art. Because digital video data is typically compressed on picture frames, and audio is typically compressed on frames of a fixed number of samples, synchronization following a discontinuity in the audio program has heretofore required that a certain frame boundary be identified as a sync point. There is, therefore, a need in the art for an improved method which avoids the need to re-synchronize video and audio data by allowing decode of the audio program to continue. In accordance with the present invention, this is accomplished by substituting a digital tone value for the audio program output value. This digital tone generation is an additional processing load on the DSP and it is desirable to minimize this load.
It is, therefore, an object of the invention to generate short tones with rapid attenuation while avoiding objectionable noise.
It is a further object of the invention to operate a digital signal processor in a memory space and processing cycles efficient manner to generate and attenuate tones.
It is a further object of the invention to attenuate a tone without creating, or at least minimizing, additional sounds or artifacts at the end of the tone, such as xe2x80x9cclicksxe2x80x9d, xe2x80x9cpopsxe2x80x9d, or xe2x80x9cthudsxe2x80x9d.
It is a further object of the invention to produce a large number of tones and tone durations across and beyond the entire audio range.
It is a further object of the invention to produce a sine wave of highly accurate frequency.
It is a further objective of the invention to replace a segment of a playing audio stream with a tone of the same sampling frequency as the audio stream in order to maintain synchronization between audio and video data.
In accordance with the method of the invention, an audible tone is generated and attenuated over a wide frequency range, such as throughout and beyond the human audible range, the tone selectively being of short duration, including the steps of generating during a tone period a digital representation of the sine of a requested tone frequency and amplitude; generating during an attenuation period a digital representation of a moderately disturbed but continuous sine of decreasing amplitude; and generating during a decay period a digital representation of a continuous function which decays to zero from the zero approach point of the sine half wave.
In accordance with a further aspect of the method of the invention, the method includes during the attenuation period the steps of multiplying the amplitude value by a fractional constant at zero crossings; incrementing within zero passing zones the amplitude between subsequent samples by reduced values to further attenuate the tone and accumulate a xe2x80x9cbankxe2x80x9d of accumulated reductions in increments; and while approaching zero crossings the steps of generating a pure sine wave of maximum amplitude equal to the amplitude at the end of the prior quadrant; and during a decay period, the step of generating a digital representation, of a continuous function which decays exponentially to zero amplitude.
In accordance with the system of the invention, a digital signal processor is provided for generating and attenuating an audible tone over a wide frequency range, such as throughout and beyond the human audible range, the tone selectively being of short duration. Responsive to a request to generate a tone of a specified tone and sampling index, tone request logic determines an increment angle. Responsive to said increment angle and a periodic sampling interrupt, sample generation logic generates during a tone period a digital representation of the sine of a requested tone frequency and amplitude; generates during an attenuation period a digital representation of a moderately disturbed but continuous sine of decreasing amplitude; and generates during a decay period a digital representation of a continuous function which decays to zero from the zero approach point of the sine half wave.